namespace LightCAD.Core.Elements
{
    public class Point : Element
    {
        public Vector2d P;
        public Point()
        {
        }
        public Point(Vector2d p)
        {
            this.P = p;
        }
        public Point(double x, double y)
        {
            this.P.X = x;
            this.P.Y = y;
        }

        public override Element Clone()
        {
            var clone = new Point();
            clone.Copy(this);
            return clone;
        }

        public override void Copy(Element src)
        {
            base.Copy(src);
            this.P = ((Point)src).P;
        }

        public void Set(Vector2d? p, bool fireChangedEvent = false)
        {
            //PropertySetter:P
            if (!fireChangedEvent) {
                if (p != null) this.P = p.Value;
            }
            else
            {
                bool chg_p = (p != null && p != this.P);
                if (chg_p)
                {
                    PropertyChangedBefore(nameof(P), this.P, p);
                    var oldValue = this.P;
                    this.P = p.Value;
                    PropertyChangedAfter(nameof(P), oldValue, this.P);
                }
            }
        }





    }
}